package org.example.platerecognize.dao;

import org.opencv.core.Mat;

public class BorderMat {
    /**图片数据*/
    public Mat mat;
    /**图片的缩放比率**/
    public float scale;
    /**往上补充的像素宽度**/
    public int fillTop;
    /**往下补充的像素宽度**/
    public int fillBottom;
    /**往左补充的像素宽度**/
    public int fillLeft;
    /**往右补充的像素宽度**/
    public int fillRight;

    public BorderMat(Mat mat, float scale, int fillTop, int fillBottom, int fillLeft, int fillRight) {
        this.mat = mat;
        this.scale = scale;
        this.fillTop = fillTop;
        this.fillBottom = fillBottom;
        this.fillLeft = fillLeft;
        this.fillRight = fillRight;
    }

    /**
     * 释放资源
     */
    public void release(){
        if(this.mat != null){
            try {
                this.mat.release();
                this.mat = null;
            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }

    @Override
    public String toString() {
        return "BorderMat{" +
                "scale=" + scale +
                ", top=" + fillTop +
                ", bottom=" + fillBottom +
                ", left=" + fillLeft +
                ", right=" + fillRight +
                '}';
    }
}
